import RoomPlanContainer from '../../components/roomPlan/RoomPlanContainer'


import { WeaDialog, WeaNewScroll } from 'ecCom';
import { inject, observer } from 'mobx-react';
import { observable, action, toJS } from 'mobx';
import {WeaLocaleProvider} from 'ecCom';
const getLabel = WeaLocaleProvider.getLabel;
@inject('meetingDialog')
@observer
export default class RoomPlanDialog extends React.Component {
  constructor(props) {
    super(props);
    this.state={
      zIndex:801,
      preventCycle:false,
    }
  }
  componentWillReceiveProps(nextProps) {
    if(this.state.zIndex != nextProps.zIndex){
			this.setState({ zIndex: nextProps.zIndex })
			
    }
    if(this.state.preventCycle != nextProps.preventCycle){
			this.setState({ preventCycle: nextProps.preventCycle })
			
		}
  }
  componentDidUpdate(prevProps, prevState) {

  }

  onCancel = () => {
    const { changePreviewMeetingTab } = this.props.meetingDialog;
    this.props.setRoomPlan(false);
    changePreviewMeetingTab('1');
  }


  render() {
    let {visible=false,width='890px',height='600px'} = this.props;
    let {preventCycle} = this.state;
    return (
      <div>
      {<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@jmq51p`}
        visible={visible}
        title={getLabel(15881,'会议室使用情况')}
        className="roomPlanDialog"
        icon="icon-coms-meeting"
        iconBgcolor="#f14a2d"
        style={{ width: width, height: height }}
        onCancel={this.onCancel}
      >
        {visible && !preventCycle && <RoomPlanContainer ecId={`${this && this.props && this.props.ecId || ''}_RoomPlanContainer@w2tu20`} meetingId={this.props.MeetingId}   mySelf={false} {...this.props} /> }
      </WeaDialog>}
      </div>
    );
  }
}